public class HardDisk {
    private int amount; // 硬盘的容量

    public HardDisk(int amount) {
        setAmount(amount);
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int m) {
        if (m > 0) {
            this.amount = m;
        } else {
            throw new IllegalArgumentException("Amount must be positive.");
        }
    }

    @Override
    public String toString() {
        return String.format("Capacity: %d GB", amount);
    }
}
